/*
 * @Author: your name
 * @Date: 2021-06-25 10:38:14
 * @LastEditTime: 2021-08-20 18:00:44
 * @LastEditors: Please set LastEditors
 * @Description: In User Settings Edit
 * @FilePath: /express_server/index.js
 */
const express = require("express");

const app = express();
const bodyParser = require("body-parser"); //引入注意使用第三方模块处理post

//Set Request Size Limit
app.use(express.json({ limit: "50mb" }));
app.use(express.urlencoded({ limit: "50mb" }));

//千万小心这个要放在所有的use前面，解析我们的post请求数据
app.use(bodyParser());

const userRouter = require("./interface/user/user"); // 用户相关接口
const tableRouter = require("./interface/tables/table"); // table相关接口

const selfRouter = require("./interface/self");

const mockRouter = require("./interface/mock");


const testRouter = require('./interface/tet')

// 该文件里的接口都是一级路由

/*
 * 用户相关接口
 * 注册、登录、获取个人信息、忘记密码、退出登录
 */
app.use("/user", userRouter);

/*
 *  table相关接口
 * 获取列表、获取详情、添加数据、删除数据、修改数据
 */
app.use("/table", tableRouter);

/**
 * 自律 相关接口
 */

app.use("/self", selfRouter);

/**
 * mock 换发
 */

app.use("/mockApi", mockRouter);


/**
 * 随便写的 测试接口
 */
app.use("/test", testRouter);

// 服务器端口号为5500
app.listen(5500, (err) => {
  if (!err)
    console.log(
      "login interface is start, Service address: http://localhost:5500 ......"
    );
});
